﻿using Sustainalytics.Common.Hosting;
using Sustainalytics.WebApiHosting;
using System;
using Sustainalytics.ProductInvolvement.BL;

namespace Sustainalytics.ProductInvolvement.Service.Infrastructure
{
    public class ProductInvolvementApplication : ServiceApplication
    {
        public ProductInvolvementApplication() : base()
        {

        }

        public ProductInvolvementApplication(IBasicLogger logger) : base(logger)
        {

        }

        protected override void AddStartupServices()
        {
            RegisterService(new WebApiServiceDefinition<Startup>(HostConfig.GetHostUrl(), "productInvolvement"));

        }

        protected override bool HandleStartException(System.Exception e)
        {
            ProductInvolvementSerilog.Log.Exception(e);
            return false;
        }

        protected override bool HandleStopException(Exception e)
        {
            throw new NotImplementedException();
        }

        protected override void OnUnhandledDomainException(System.Exception e)
        {
            ProductInvolvementSerilog.Log.Exception(e);
        }
    }
}

